home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1988 October
/
Ahoy_Magazine_88-10_1988_Double_L.d64
/
Sprite Rotator
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
4KB
|
137 lines
0 poke52,45:poke56,45:clr
1 ifpeek(2040)<180thenpoke2040,255
2 ifpeek(2041)<180thenpoke2041,254
3 ifpeek(49152)<>76thenload"rot.ml",8,1
10 poke53280,0:poke53281,0:poke53269,0:poke53248,220:poke53249,100
15 poke53271,3:poke53277,3
20 poke53251,100:poke53250,30:print"[147]sprite rotator":poke53264,2
25 print"designed by john fedor":poke53287,1:poke53288,1:goto120
30 a=sqr(x^2+y^2):ifx=0thenb=0:goto55
50 b=atn(y/x):ifsgn(y)=1andsgn(x)=-1thenb=b+(NULL)
51 ifsgn(y)=-1andsgn(x)=-1thenb=b+(NULL)
52 ifsgn(x)=-1andy=0thenb=(NULL)
53 ifsgn(x)=1andy=0thenb=0
54 goto60
55 ifsgn(y)=1thenb=(NULL)/2
56 ifsgn(y)=-1thenb=-(NULL)/2
60 d1=de*(NULL)/180:y1=int(.5+a*sin(d1+b)):x1=int(.5+a*cos(d1+b)):return
90 x1=x+11:y1=10-y:q=s1*64+y1*3+int(x1/8):do=peek(q)and(2^(7-(x1and7))):return
100 ifx1<-11ory1<-10orx1>12ory1>10thenreturn
105 x2=x1+11:y2=10-y1:q=s2*64+y2*3+int(x2/8)
110 pokeq,peek(q)or(2^(7-(x2and7))):return
120 print"1. load in sprites shapes
125 [153]"2. change source sprite
130 print"3. change destination sprite
135 [153]"4. rotate sprite
140 print"5. animate sprites
150 [153]"6. save sprites
152 print"7. touch-up sprite
153 [153]"8. copy source to destination
155 s1=peek(2040):s2=peek(2041)
160 poke198,0
170 geta$:ifa$<"1"ora$>"8"then170
175 a=val(a$):onagosub200,250,300,400,500,350,600,1000
180 run
200 print"[147]what is the filename (load)
202 f$[178]"":[133]f$:[139]f$[178]""[167][138]
203 [159]15,8,15,"i0
204 input#15,a,b$,c,d:ifathenprinta;b$;c;d:close15:fori=1to5000:next:run
205 open5,8,5,f$+",p,r
206 [132]15,a,b$,c,d:[139]a[167][153]a;b$;c;d:[160]15:[129]i[178]1[164]5000:[130]:[138]
207 [161]#5,a$,b$:[160]5
208 c$[178][199](0):s1[178][198](a$[170]c$)[170][198](b$[170]c$)[172]256:s1[178]s1[173]64
209 [151]2040,s1
210 [147]f$,8,1
220 [138]
250 [151]53269,1
260 [153]"loadcurrent shape:"s1
265 [153]"use +/- to adjust. <return> to end.":[151]650,128
270 [161]a$:[139]a$[178]"+"[167]s1[178]s1[170]1:[139]s1[177]255[167]s1[178]255
275 [139]a$[178]"-"[167]s1[178]s1[171]1:[139]s1[179]180[167]s1[178]180
280 [151]2040,s1:[153]""[163]14)s1
285 [139]a$[179][177][199](13)[167]270
290 [151]650,0:[138]
300 [151]53269,2
310 [153]"loadcurrent shape:"s2
315 [153]"use +/- to adjust. <return> to end.":[151]650,128
320 [161]a$:[139]a$[178]"+"[167]s2[178]s2[170]1:[139]s2[177]255[167]s2[178]255
325 [139]a$[178]"-"[167]s2[178]s2[171]1:[139]s2[179]180[167]s2[178]180
330 [151]2041,s2:[153]""[163]14)s2
335 [139]a$[179][177][199](13)[167]320
340 [151]650,0:[138]
350 [139]s1[177]s2[167][153]"not possible":[129]i[178]1[164]5000:[130]:[138]
353 [153]"loadwhat is the filename (save)"
354 f$[178]"":[133]f$:[139]f$[178]""[167][138]
355 [159]15,8,15,"i0":[152]15,"s0:"[170]f$
356 [159]5,8,5,f$[170]",p,w
360 a%=(s1*64)/256:b%=(s1*64)-a%*256
363 print"saving...."
365 print#5,chr$(b%)chr$(a%);
370 fori=s1*64tos2*64+63:print#5,chr$(peek(i));:next
375 close5
377 input#15,a,b$,c,d:ifathenprinta;b$;c;d:fori=1to5000:next
378 close15
380 run
400 fori=s2*64tos2*64+63:pokei,0:next
410 poke53269,3
415 print"[147]what is the rotation (in degrees)";
420 inputde
430 print"[147]calculating..."de"degrees":printtab(25)peek(2040)tab(33)peek(2041)
435 fory=-10to10:forx=-11to12:gosub90:ifdothengosub30:gosub100
445 next:next:print""tab(14)"done"
450 forx=1to2000:next:run
500 print"[147]press +/- to adjust highlighted sprite
510 [153]"press <return> to switch start/end
515 print"press f1 to begin.
520 [151]650,128:[151]53269,3:x[178]1:a1$[178]"":a2$[178]"wait
522 printa1$"start:[146]"s1:printa2$"end :[146]"s2
523 poke2040,s1:poke2041,s2
525 geta$:ifa$="+"andx=1thens1=s1+1:ifs1>255thens1=255
526 ifa$="+"andx=2thens2=s2+1:ifs2>255thens2=255
527 ifa$="-"andx=1thens1=s1-1:ifs1<180thens1=180
528 ifa$="-"andx=2thens2=s2-1:ifs2<180thens2=180
530 ifa$=chr$(13)thenx=3-x:b$=a1$:a1$=a2$:a2$=b$
535 ifa$<>"[133]"then522
540 print"[147]press +/- to adjust speed
545 [153]"press <return> to exit
550 poke53269,1:x=20
555 fori=s1tos2stepsgn(s2-s1):poke2040,i
560 forq=1tox:next
565 geta$:ifa$="+"thenx=x+1
570 ifa$="-"thenx=x-1:ifx<1thenx=1
575 ifa$<>chr$(13)thennext:goto555
580 poke2040,s1:poke650,0:run
600 print"[147]":poke53269,5
606 print"f1 - exits m - mirror"
607 print"f - flip i - invert clr/home - clear
610 [158]49158:[141]900
630 ly[178]0:lx[178]0
635 [151]2042,14
640 [129]i[178]896[164]959:[151]i,0:[130]
645 [129]i[178]896[164]913[169]3:[151]i,252:[130]
650 [151]53289,7:[151]53252,lx[172]8[170]24:[151]53253,ly[172]8[170]82
655 [161]a$:[139]a$[178]"load"[167][129]i[178]s1[172]64[164]s1[172]64[170]63:[151]i,0:[130]:[141]900:[137]655
660 [139]a$[178]"input"[167][138]
665 [139]a$[178]"f"[167]800
670 [139]a$[178]"m"[167]850
675 [139]a$[178]"i"[167][129]i[178]s1[172]64[164]s1[172]64[170]63:[151]i,255[171][194](i):[130]:[141]900:[137]655
680 a[178]15[171][194](56320)[175]15
685 [139](a[175]1)[167]ly[178]ly[171]1:[139]ly[179]0[167]ly[178]20
690 [139](a[175]2)[167]ly[178]ly[170]1:[139]ly[177]20[167]ly[178]0
695 [139](a[175]4)[167]lx[178]lx[171]1:[139]lx[179]0[167]lx[178]23
700 [139](a[175]8)[167]lx[178]lx[170]1:[139]lx[177]23[167]lx[178]0
705 [139]([194](56320)[175]16)[167]650
710 a[178]s1[172]64[170]ly[172]3[170][181](lx[173]8)
715 b[178]7[171](lx[175]7):[139]([194](a)[175](2[174]b))[167][151]a,[194](a)[175](255[171](2[174]b)):[137]722
720 [151]a,[194](a)[176](2[174]b)
722 z[178]lx[170]ly[172]40[170]55296[170]160
723 a[178][194](z)[175]15:a1[178]1:[139]a1[178]a[167]a1[178]12
724 [151]z,a1
725 [137]650
800 a[178]s1[172]64:[151]252,a[173]256:[151]251,a[171][194](252)[172]256:[158]49152:[141]900
820 [137]650
850 a[178]s1[172]64:[151]252,a[173]256:[151]251,a[171][194](252)[172]256:[158]49155:[141]900
870 [137]650
900 a[178]s1[172]64:[151]252,a[173]256:[151]251,a[171][194](252)[172]256:[158]49377:[142]
1000 [129]i[178]0[164]63:[151]s2[172]64[170]i,[194](s1[172]64[170]i):[130]:[138]